<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    var removeDuplicates = function(nums) {
        const numsResult =  Array.from(new Set(nums))
        nums.splice(0,nums.length,...numsResult) // 删除该数组中的所有项目，替换成新数组中的项目
        return nums.length
    };
    console.log(removeDuplicates([1,1,2]))
  </script>
</html>
